home *** CD-ROM | disk | FTP | other *** search
/ Item MB Quick & Easy 2.0 / Item MB Quick & Easy 2.0.iso / mbfacad / eaitstk2.lsp < prev    next >
Lisp/Scheme  |  1998-03-15  |  21KB  |  593 lines

  1. (EAITmsg "mb_mld3" "\n" "002" "\n")
  2. (princ)
  3.  
  4. ;*****Stⁿckliste Hauptmenⁿ
  5.  
  6. (defun EAITSTMEN (/ AIT-D AIT-X AIT-L)
  7.    (EAITmsg "mb_mld3" "\n\n" "024" "\n")
  8.    (EAITvari)
  9.    (EAITvars)
  10.    (setq AIT-D  (open (strcat EAITpfm "dwg.$$$") "w"))
  11.    (if AIT-D (progn
  12.            (setq AIT-X (strcase (cdr (SplitFn (getvar "dwgname")))))
  13.            (prin1 AIT-X AIT-D)
  14.            (close AIT-D)
  15.            (if (NOT (AND (findfile (strcat EAITpfn "ml/mb-stckl.imd")) (= EAITml3 1)))
  16.                 (command "EAITshell" (strcat EAITKAT " " EAITpfm))
  17.                  (command "EAITshell" EAITSTCKL)
  18.            );if
  19.            (EAITst-info)
  20.          );progn
  21.    )
  22.    (EAITvarz)
  23.    (load (strcat (strcat EAITpfn "EAIT" EAITds EAITpm)))
  24.    (menucmd "p1=*")
  25.    (princ)
  26. )
  27.  
  28.  
  29. ;****  Einlesen und sortieren
  30.  
  31. (defun EAITSTEIN ( / AIT-D AIT-X AIT-Y AIT-Z AIT-L what_next stichwort thema)
  32.    (EAITmsg "mb_mld3" "\n\n" "025" "\n")
  33.    (EAITvari)
  34.    (EAITvars)
  35.    ;AIT-D=dwg.$$$
  36.    (setq AIT-D (open (strcat EAITpfm "dwg.$$$") "w"))
  37.    (if AIT-D (progn
  38.            (setq AIT-X (strcase (cdr (splitfn (getvar "dwgname"))))
  39.              AIT-Y ","
  40.              AIT-Z "IM"
  41.            )
  42.            ;Dateiname:
  43.            (prin1 AIT-X AIT-D)
  44.            (princ AIT-Y AIT-D)
  45.            (prin1 AIT-Z AIT-D)
  46.            (princ AIT-Y AIT-D)
  47.            ;letzte Positionsnummer:
  48.            (prin1 EAITpos AIT-D)
  49.            ;Datei schliessen:
  50.            (close AIT-D)
  51.            (setq what_next 1)
  52.            (if (= EAITposs 1) ;Positionen schon vergeben  in Merker/Schalter gesetzt
  53.            (progn
  54.  
  55. ;****Warnung bei schon vergebenen Pos.zahlen
  56.  
  57.                (if (< (setq dcl_id (load_dialog (strcat EAITpfd "EAITem"))) 0)
  58.                    (exit)
  59.                )
  60.                (new_dialog "pos_warnung" dcl_id)
  61.  
  62.                (set_tile "Titel" (EAITmg "mb_mld15" "016"));Achtung
  63.                (set_tile "Meldung17" (EAITmg "mb_mld15" "017"));schon angezogene Positionen verΣndern sich !
  64.                        (setq thema (EAITmg "mb_mld21" "012");Hilfe fuer einen item-Befehl
  65.                              stichwort ":item1"
  66.                        )
  67.                        (action_tile "help" "(hilfe stichwort thema)")
  68.  
  69.                (action_tile "accept"      "(done_dialog 1)")    
  70.                (action_tile "cancel"      "(done_dialog 0)")
  71.     
  72.                (setq what_next (start_dialog))   ; Throw up the dialogue.
  73.  
  74.                (unload_dialog dcl_id)
  75.  
  76.            );progn
  77.            );if
  78.            ;Programm geht bei ok weiter:
  79.            (if (= what_next 1)
  80.           (progn
  81.               
  82.               ;Nummern einfuegen:
  83.               (if (AND (findfile (strcat EAITpfn "ml/mb-stckl.imd"))(= EAITml3 1))  ;in Merker/Schalter gesetzt
  84.                  (progn
  85.                  ;Nummernvergabe ok:
  86.                  (if (= EAITposs 0)
  87.                     (progn
  88.                       (if (tblsearch "BLOCK" "AIT$MERK") ;Merker-Bloecke vorhanden
  89.                          (progn
  90.                       ;        attext  SDF     Schablonendatei            Ausgabedatei
  91.                            (command EAITatt EAITats (strcat EAITpfn "mb_stpa") (strcat EAITpfm "AIT$2D"))
  92.                       (EAITreadwrite (strcat EAITpfm "AIT$2D"))
  93.                       (command EAITatt EAITats (strcat EAITpfn "3d/3d_stpa") (strcat EAITpfm "AIT$3D"))
  94.                       (EAITreadwrite (strcat EAITpfm "AIT$3D"))
  95.                       ;extrahieren Bauteildaten + alte Positionsnummer aus Block mit der Nummer
  96.                          )
  97.                       );if
  98.                       (command EAITatt EAITats (strcat EAITpfn "mb_stpos") (strcat EAITpfm AIT-X))
  99.                   (EAITreadwrite (strcat EAITpfm AIT-X))
  100.                   (if (NOT (findfile (strcat EAITpfm AIT-X)))
  101.                     (command EAITatt EAITats (strcat EAITpfn "mb_stpos") (strcat EAITpfm AIT-X))
  102.                   )
  103.                   (command EAITatt EAITats (strcat EAITpfn "3d/3d_stpos") (strcat EAITpfm "3d"))
  104.                   (EAITreadwrite (strcat EAITpfm "3d"))
  105.                    ;extrahieren Bauteildaten + alte Positionsnummer aus Block mit der Nummer
  106.                       (if (tblsearch "BLOCK" "AIT$MERK") ;wenn Block AIT$MERK vorhanden
  107.                     (EAITwattstckl)
  108.                       )
  109.                   ;Aufruf der ML3 Stⁿckliste
  110.                     (command "EAITshell" EAITSTCKL)
  111.                  );progn
  112.                  (progn ;Nummernvergabe nicht ok
  113.                    (if (tblsearch "BLOCK" "AIT$MERK")
  114.                       (progn
  115.                         (command EAITatt EAITats (strcat EAITpfn "mb_stpax") (strcat EAITpfm "AIT$2D"))
  116.                    (if (NOT (findfile (strcat EAITpfm "AIT$2D")))
  117.                              (command EAITatt EAITats (strcat EAITpfn "mb_stpax") (strcat EAITpfm "AIT$2D"))
  118.                    )
  119.                    (EAITreadwrite (strcat EAITpfm "AIT$2D"))
  120.                    (command EAITatt EAITats (strcat EAITpfn "3d/3d_stpax") (strcat EAITpfm "AIT$3D"))
  121.                    (EAITreadwrite (strcat EAITpfm "AIT$3D"))
  122.                       )
  123.                    )
  124.                    (command EAITatt EAITats (strcat EAITpfn "mb_stpox") (strcat EAITpfm AIT-X))
  125.                (EAITreadwrite (strcat EAITpfm AIT-X))
  126.                (if (NOT (findfile (strcat EAITpfm AIT-X)))
  127.                  (command EAITatt EAITats (strcat EAITpfn "mb_stpox") (strcat EAITpfm AIT-X))
  128.                )
  129.                (command EAITatt EAITats (strcat EAITpfn "3d/3d_stpox") (strcat EAITpfm "3d"))
  130.                (EAITreadwrite (strcat EAITpfm "3d"))
  131.                    (if (tblsearch "BLOCK" "AIT$MERK")
  132.                          (EAITwattstckl)
  133.                    )
  134.                ;Aufruf der ML3 Stⁿckliste
  135.                  (command "EAITshell" EAITSTCKL)
  136.                  );progn
  137.                  );if  ;Ende 18.10.
  138.                  (EAITref)
  139.                  (EAITst-info)
  140.                  );progn
  141.                  (progn
  142.                    (if (= EAITposs 0)
  143.                       (progn 
  144.                          (if (tblsearch "BLOCK" "AIT$MERK")
  145.                             (progn
  146.                               (command EAITatt EAITats (strcat EAITpfn "mb_stpa") (strcat EAITpfm "AIT$2D"))
  147.                               (command EAITatt EAITats (strcat EAITpfn "3d/3d_stpa") (strcat EAITpfm "AIT$3D"))
  148.                             )
  149.                          )
  150.                          (command EAITatt EAITats (strcat EAITpfn "mb_stpos") (strcat EAITpfm "EAIT2D"))
  151.                          (command EAITatt EAITats (strcat EAITpfn "3d/3d_stpos") (strcat EAITpfm "EAIT3D"))
  152.                          (if (tblsearch "BLOCK" "AIT$MERK")
  153.                             (EAITwattsort)
  154.                          )
  155.                         (command "EAITshell" (strcat EAITSORT " " AIT-X " " (rtos EAITpos 2 0) " " EAITpfm " " EAITpfd))
  156.                      ;Befehl"ISORT.EXE";Parameter: Zeichnungsname, erste Pos.,  Temp-Pfad,Datenpfad         
  157.                       )
  158.                       (progn
  159.                          (if (tblsearch "BLOCK" "AIT$MERK")
  160.                             (progn
  161.                               (command EAITatt EAITats (strcat EAITpfn "mb_stpax") (strcat EAITpfm "AIT$2D"))
  162.                               (command EAITatt EAITats (strcat EAITpfn "3d/3d_stpax") (strcat EAITpfm "AIT$3D"))
  163.                             )
  164.                          )
  165.                          (command EAITatt EAITats (strcat EAITpfn "mb_stpox") (strcat EAITpfm "EAIT2D"))                               
  166.                          (command EAITatt EAITats (strcat EAITpfn "3d/3d_stpox") (strcat EAITpfm "EAIT3D"))
  167.                          (if (tblsearch "BLOCK" "AIT$MERK")
  168.                            (EAITwattsort)
  169.                          )
  170.                         (command "EAITshell" (strcat EAITSORT " " AIT-X " " (rtos EAITpos 2 0) " " EAITpfm " " EAITpfd))
  171.                      ;Befehl"ISORT.EXE";Parameter: Zeichnungsname, erste Pos.,  Temp-Pfad,Datenpfad         
  172.                       )
  173.                    );if
  174.                    (EAITref)
  175.                  )
  176.               );if
  177.           );progn
  178.            );if (= what_next 1)
  179.      )
  180.    )
  181.    (EAITvarz)
  182.    (menucmd "p1=*")
  183.    (princ)
  184.    
  185. )
  186.  
  187.  
  188. ;******in Grafik ⁿbertragen
  189.  
  190. (defun EAITSTINZ (/ AIT-D AIT-X AIT-Y AIT-Z AIT-L)
  191.    (EAITvari)
  192.    (EAITvars)
  193.    (setq AIT-D (open (strcat EAITpfm "dwg.$$$") "w"))
  194.    (if AIT-D (progn
  195.            (setq AIT-X (strcase (cdr (splitfn (getvar "dwgname"))))
  196.              AIT-Y ","
  197.              AIT-Z "EX")
  198.            (prin1 AIT-X AIT-D)
  199.            (princ AIT-Y AIT-D)
  200.            (prin1 AIT-Z AIT-D)
  201.            (close AIT-D)
  202.            (if (AND (findfile (strcat EAITpfn "ml/mb-stckl.imd"))(= EAITml3 1))
  203.          (progn
  204. ;               Aufruf der ML3 Stⁿckliste
  205.             (command "EAITshell" EAITSTCKL)
  206. ;           (command "EAITstckl")
  207.            (EAITST-INFO)
  208.          )
  209.          (progn
  210.            (if (findfile (strcat EAITpfm "EAITexp.txt"))(EAITGRAFIK (strcat EAITpfm "EAITexp.txt")) )
  211.          )
  212.            )
  213.      )
  214.    )
  215.    (EAITvarz)
  216.    (menucmd "p1=*")
  217.    (princ)
  218. )
  219.  
  220.  
  221.  
  222.  
  223. ***wird nur für ML3-Stückliste benötigt, zur Übergabe der Daten
  224.  
  225. (defun EAITST-INFO (/ AIT-D AIT-INFO AIT-L AIT-MBFUN AIT-MBDAT)
  226.   (redraw)
  227.   (setq AIT-D (open (strcat EAITpfm "dwg.$$$") "r"))
  228.   (if AIT-D (progn
  229.           (setq AIT-INFO (read-line AIT-D)
  230.             AIT-L (strlen AIT-INFO))
  231.           (while (/= AIT-L 0)
  232.             (if (= (substr AIT-INFO AIT-L 1) ",")
  233.                (progn
  234.                    (setq AIT-INFO (substr AIT-INFO 1 (1- AIT-l))
  235.                      AIT-MBFUN (substr AIT-INFO (- AIT-L 3) 2)
  236.                      AIT-L 0
  237.                    )
  238.                    (if (= AIT-MBFUN "GR")
  239.                   (progn
  240.                      (setq AIT-MBDAT (substr AIT-INFO 2 (- (strlen AIT-INFO) 7)))
  241.                      (EAITGRAFIK AIT-MBDAT)
  242.                   );progn
  243.                    );if
  244.             );progn
  245.             (setq AIT-L (1- AIT-L))
  246.             );if
  247.           );while
  248.           (close AIT-D)
  249.           (command "EAITshell" (strcat "del" EAITpfm "DWG.$$$"))
  250.         )
  251.   )
  252. )
  253.  
  254.  
  255.  
  256.  
  257. (defun EAITGRAFIK (AIT-ST-Name / AIT-ST-Datei AIT-ST-Zeile AIT-ST-Pos AIT-ST-Nr AIT-ST-Bez1 AIT-ST-Bez2
  258.                  AIT-ST-Bez3 AIT-ST-Bez4 AIT-ST-Bez5 AIT-ST-Bez6 AIT-ST-Lae AIT-ST-Br AIT-ST-Anz
  259.                  AIT-ST-Nr1 AIT-ST-Nr2 AIT-ST-Nr3 AIT-ST-Nr4 AIT-ST-Nr5 AIT-ST-Nr6 AIT-ST-Nr7
  260.                  AIT-ST-VT AIT-P-ST)
  261.   (EAITmsg "mb_mld3" "\n\n" "027" "\n")
  262.   (EAITmsg "mb_mld3" "\n" "028" nil)
  263.   (setvar "OSMODE" 1)
  264.   (setq AIT-P-ST (getpoint))
  265.   (setvar "OSMODE" 0)
  266.   (if (/= AIT-P-ST nil)
  267.      (progn
  268.     (command EAITege (strcat EAITpfm "EAITplti") AIT-P-ST EAITms "" "")
  269.     (setq AIT-ST-Datei (open AIT-ST-Name "r"))
  270.     (if AIT-ST-Datei
  271.        (progn
  272.           (setq AIT-ST-Zeile  (read-line AIT-ST-Datei))
  273.           (while AIT-ST-Zeile
  274.         (setq AIT-ST-Pos  (atoi (substr AIT-ST-Zeile   1  4))
  275.               AIT-ST-Anz  (atoi (substr AIT-ST-Zeile   5  4))
  276.               AIT-ST-Bez1 (substr AIT-ST-Zeile   9 30)
  277.               AIT-ST-Bez2 (substr AIT-ST-Zeile  39 30)
  278.               AIT-ST-Bez3 (substr AIT-ST-Zeile  69 30)
  279.               AIT-ST-Bez4 (substr AIT-ST-Zeile  99 30)
  280.               AIT-ST-Bez5 (substr AIT-ST-Zeile 129 30)
  281.               AIT-ST-Bez6 (substr AIT-ST-Zeile 159 30)
  282.               AIT-ST-Lae  (atof (substr AIT-ST-Zeile 189  6))
  283.               AIT-ST-Br   (atof (substr AIT-ST-Zeile 195  6))
  284.          )
  285.         (if (OR (= (setq AIT-ST-Nr1  (substr AIT-ST-Zeile 201  1)) NULL)(= AIT-ST-Nr1 " "))(setq AIT-ST-Nr1 "0"))
  286.         (if (OR (= (setq AIT-ST-Nr2  (substr AIT-ST-Zeile 202  1)) NULL)(= AIT-ST-Nr2 " "))(setq AIT-ST-Nr2 "0"))
  287.         (if (OR (= (setq AIT-ST-Nr3  (substr AIT-ST-Zeile 203  1)) NULL)(= AIT-ST-Nr3 " "))(setq AIT-ST-Nr3 "0"))
  288.         (setq AIT-ST-Nr3  (strcat AIT-ST-Nr3 (substr AIT-ST-Zeile 204  2))
  289.               AIT-ST-Nr4  (substr AIT-ST-Zeile 206  2)
  290.               AIT-ST-Nr5  (substr AIT-ST-Zeile 208  1)
  291.               AIT-ST-Nr6  (substr AIT-ST-Zeile 209  3)
  292.               AIT-ST-Nr7  (substr AIT-ST-Zeile 212  1)
  293.               AIT-ST-VT   (substr AIT-ST-Zeile 213  1)
  294. ;alt komplette item-Nummer   AIT-ST-Nr   (strcat AIT-ST-Nr1 "." AIT-ST-Nr2 "." AIT-ST-Nr3 "." AIT-ST-Nr4 " ." AIT-ST-Nr5 "." AIT-ST-Nr6 "." AIT-ST-Nr7 " " AIT-ST-VT)
  295.               AIT-ST-Nr   (strcat AIT-ST-Nr1 "." AIT-ST-Nr2 "." AIT-ST-Nr3 "." AIT-ST-Nr4)
  296.               AIT-P-ST    (list (car AIT-P-ST)(+ (cadr AIT-P-ST)(* 4 EAITms)))
  297.         )
  298.         (if (/= AIT-ST-Lae 0.0)
  299.             (if (/= AIT-ST-Br 0.0)
  300.             (progn
  301.                (setvar "luprec" 0)
  302.                (setq AIT-ST-Bez2 (strcat (EAITmg "mb_mld3" "029")(rtos AIT-ST-Lae 2 0)(EAITmg "mb_mld3" "030")(rtos AIT-ST-Br 2 0)))
  303.             )
  304.             (progn
  305.                (setvar "luprec" 1)
  306.                (setq AIT-ST-Bez2 (strcat (EAITmg "mb_mld3" "029") (rtos AIT-ST-Lae 2 1)))
  307.             )
  308.             )
  309.         )
  310.         (if (< AIT-ST-Bez1 "0")(setq AIT-ST-Bez1 AIT-ST-Bez2 AIT-ST-Bez2 " "))
  311.         (if (< AIT-ST-Bez3 "0")(setq AIT-ST-Bez3 AIT-ST-Bez4 AIT-ST-Bez4 " "))
  312.         (if (< AIT-ST-Bez5 "0")(setq AIT-ST-Bez5 AIT-ST-Bez6 AIT-ST-Bez6 " "))
  313.  
  314.         (if (< AIT-ST-Bez3 "0")
  315.             (setq AIT-ST-Bez3 AIT-ST-Nr)
  316.             (setq AIT-ST-Bez4 AIT-ST-Nr)
  317.         )
  318.  
  319.         (command EAITege (strcat EAITpfn "EAITplli") AIT-P-ST EAITms "" "" "" "" AIT-ST-Bez2 AIT-ST-Bez4 AIT-ST-Bez6)
  320.         (setq AIT-P-ST (list (car AIT-P-ST)(+ (cadr AIT-P-ST)(* 4 EAITms))))
  321.         (command EAITege (strcat EAITpfn "EAITplli") AIT-P-ST EAITms "" "" AIT-ST-Pos AIT-ST-Anz AIT-ST-Bez1 AIT-ST-Bez3 AIT-ST-Bez5)
  322.         (setq AIT-ST-Zeile (read-line AIT-ST-Datei))
  323.           )
  324.           (close AIT-ST-Datei)
  325.        )
  326.        (princ)
  327.     )
  328.      )
  329.   )
  330. )
  331.  
  332.  
  333.  
  334. (defun EAITREF (/ AIT-D AIT-Z1 AIT-E AIT-Pos AIT-Idx AIT-Posx AIT-Posy)
  335.   (if (AND (findfile (strcat EAITpfn "ml/mb-stckl.imd"))(= EAITml3 1))
  336.          (setq AIT-D (open (strcat EAITpfm "3D.TXT") "r") )
  337.      (setq AIT-D (open (strcat EAITpfm "EAITREF.TXT") "r") )
  338.   )
  339.   (if AIT-D
  340.     (progn
  341.        (setq AIT-Z1 (read-line AIT-D))
  342.        (while AIT-Z1
  343.      (setq AIT-Pos (atoi (substr AIT-Z1  1 4))
  344.            AIT-Idx (atoi (substr AIT-Z1 5 1))
  345.            AIT-E   (entget(entnext(handent (substr AIT-Z1 6 16))))
  346.            AIT-Posy (cdr (assoc 1 (entget(entnext(handent (substr AIT-Z1 6 16))))))
  347.            AIT-Posx (EAITposx AIT-Posy AIT-Pos AIT-Idx)
  348.      )
  349.      (setq AIT-E   (subst (cons 1 AIT-Posx)(assoc 1 AIT-E) AIT-E) )
  350.      (entmod AIT-E)
  351.      (if (= EAITposs 0)
  352.         (if (> AIT-Pos EAITpos)(setq EAITpos AIT-Pos))
  353.         (setq EAITpos AIT-Pos)
  354.      )
  355.      (setq AIT-Z1 (read-line AIT-D) )
  356.        )
  357.        (close AIT-D)
  358.        (EAITmkr "S" nil)
  359.        (command EAITreg)
  360.     )
  361.     (princ)
  362.   )
  363.   (princ)
  364. )
  365.  
  366.  
  367. ;Schreiben einer Datei AIT-X.txt bestehend aus AIT-X.txt + ait$2d.txt
  368. ;und schreiben einer Datei 3d.txt bestehend aus 3d.txt + ait$3d.txt
  369. ;für MB-STCKL.IMD
  370. (defun EAITwattstckl ( / zeile 2d ait$2d 3d ait$3d )
  371.  
  372. ;     2D 
  373. (if (AND (findfile (strcat EAITpfm  AIT-X ".TXT")) (findfile (strcat EAITpfm "AIT$2D.TXT")))
  374.    (progn
  375.     (setq 2d (open (strcat EAITpfm AIT-X ".TXT") "a"))
  376.     (setq ait$2d (open (strcat EAITpfm "AIT$2D.TXT") "r"))
  377.         (while (setq zeile (read-line ait$2d))
  378.        (write-line zeile 2d)
  379.         );while
  380.         (close ait$2d)
  381.         (close 2d)
  382.    )
  383. )
  384.  
  385. ;     3D 
  386. (if (AND (findfile (strcat EAITpfm "3D.TXT")) (findfile (strcat EAITpfm "AIT$3D.TXT")))
  387.    (progn
  388.     (setq 3d (open (strcat EAITpfm "3D.TXT") "a"))
  389.     (setq ait$3d (open (strcat EAITpfm "AIT$3D.TXT") "r"))
  390.         (while (setq zeile (read-line ait$3d))
  391.        (write-line zeile 3d)
  392.         );while
  393.         (close ait$3d)
  394.         (close 3d)
  395.    )
  396. )
  397.  
  398. );defun EAITwattstckl
  399.  
  400.  
  401.  
  402. ;Schreiben einer Datei     eait2d.txt bestehend aus eait2d.txt + ait$2d.txt
  403. ;und schreiben einer Datei eait3d.txt bestehend aus eait3d.txt + ait$3d.txt
  404. ;fⁿr ISORT.EXE
  405. (defun EAITwattsort ( / zeile eait3d ait$3d )
  406.  
  407. ;     2D 
  408. (if (AND (findfile (strcat EAITpfm "EAIT2D.TXT"))(findfile (strcat EAITpfm "AIT$2D.TXT")))
  409.    (progn
  410.     (setq eait2d (open (strcat EAITpfm "EAIT2D.TXT") "a"))
  411.     (setq ait$2d (open (strcat EAITpfm "AIT$2D.TXT") "r"))
  412.         (while (setq zeile (read-line ait$2d))
  413.        (write-line zeile eait2d)
  414.         );while
  415.         (close ait$2d)
  416.         (close eait2d)
  417.    )
  418. )
  419.  
  420. ;     3D 
  421. (if (AND (findfile (strcat EAITpfm "EAIT3D.TXT"))(findfile (strcat EAITpfm "AIT$3D.TXT")))
  422.    (progn
  423.     (setq eait3d (open (strcat EAITpfm "EAIT3D.TXT") "a"))
  424.     (setq ait$3d (open (strcat EAITpfm "AIT$3D.TXT") "r"))
  425.         (while (setq zeile (read-line ait$3d))
  426.        (write-line zeile eait3d)
  427.         );while
  428.         (close ait$3d)
  429.         (close eait3d)
  430.    )
  431. )
  432.  
  433. );defun EAITwattsort
  434.  
  435.  
  436. ;-----------------------------------------------------------------------------
  437. ;Funktion zur Aktualisierung der Positionsnummern von 3D-Bloecken
  438.  
  439. (defun c:EAIT3Dpositionrefresh ( / asatzdaten z1 z2 elepos refdata refwert ref ele3d
  440.                            ele3dpos posele3d eleposnr3d nrele3d
  441.                            attpos attposneu atteledata atteledataneu
  442.                                )
  443.  
  444.   ;Erfassung aller 3D-Positionsnummern:
  445.   (setq asatzdaten (ssget "X" '((0 . "INSERT") (-3 ("INFO_REFERENZ")))))
  446.    (if (/= asatzdaten nil)
  447.     (progn
  448.        (setq z2 (sslength asatzdaten)
  449.              z1 0
  450.         )
  451.         (repeat z2
  452.            (setq elepos (ssname asatzdaten z1)
  453.                  z1 (+ z1 1)
  454.                  refdata (entget elepos '("INFO_REFERENZ")) 
  455.                  refwert (cdr (assoc -3 refdata))
  456.                  ref (cdr (assoc 1005 (cdar refwert)))
  457.                  ele3d (handent ref)
  458.           )
  459.           (if (/= ele3d nil)
  460.            (progn
  461.              ;Attribut mit Positionsnummer des 3D-Blocks 
  462.              (setq ele3dpos (entnext ele3d))
  463.              (if (= (cdr (assoc 2 (entget ele3dpos))) "EAIT3D_POSITION")
  464.               (progn
  465.                 ;Positionsnummer des 3D-Blockes:
  466.                 (setq posele3d (cdr (assoc 1 (entget ele3dpos)))
  467.                       eleposnr3d (entnext elepos)
  468.                 )
  469.                 (if (= (cdr (assoc 2 (entget eleposnr3d))) "EAIT3D_POS")
  470.                  (progn
  471.                   ;Positionsnummer der Position:
  472.                   (setq nrele3d (cdr (assoc 1 (entget eleposnr3d))))
  473.  
  474.                   ;Abgleich:
  475.                   (If (/= posele3d nrele3d)
  476.                    (progn
  477.                            ;alte Positionsnummer:
  478.                      (setq attpos (assoc 1 (entget eleposnr3d))
  479.                            ;neue Positionsnummer:
  480.                            attposneu (cons 1 posele3d)
  481.                            ;alte Elementdaten:
  482.                            atteledata (entget eleposnr3d)
  483.                            ;neue Elementdaten:
  484.                            atteledataneu (subst attposneu attpos atteledata)
  485.                      )
  486.                      (entmod atteledataneu)
  487.                      (command "_.regen")
  488.                    ) ;progn
  489.                   ) ;if
  490.  
  491.                  ) ;progn
  492.                 ) ;if
  493.                 
  494.               ) ;progn
  495.              ) ;if
  496.  
  497.            ) ;progn
  498.           ) ;if
  499.  
  500.         ) ;repeat
  501.     ) ;progn
  502.    ) ;if
  503. (princ)
  504. )
  505.  
  506. ;-----------------------------------------------------------------------------
  507. ;Hilfs-Funktion zur Anzeige aller Attributwerte eines Blockes
  508.  
  509. (defun c:EAIT_atte ( / ele1 ele1a ele2 ele3 ele4)
  510.    (setq ele1  (car (entsel))
  511.          ele1a (entget ele1)
  512.          ele2 "start"
  513.          ele3 ele1
  514.    )
  515.     (if (/= ele1 nil)
  516.      (progn
  517.        (if (= (cdr (assoc 66 ele1a)) 1)
  518.         (progn
  519.           (while (/= ele2 "SEQEND")
  520.             (setq ele3 (entnext ele3)
  521.                   ele2 (cdr (assoc 0 (entget ele3)))
  522.                   ele4 (cdr (assoc 2 (entget ele3)))
  523.             )
  524.             (print ele4)
  525.           )
  526.         )
  527.        )
  528.      )
  529.     )
  530. )
  531.  
  532. ;-----------------------------------------------------------------------------
  533. ;Funktion zur Anzeige von Bauteilen referenzierter Positionsnummern
  534.  
  535. (defun c:EAITzeigbauteil ()
  536.         
  537.         (setvar "OSMODE" 512)
  538.         (EAITmsg "mb_mld21" "\n" "014" ":");Positionsnummer waehlen
  539.         (setq  eppunkt (getpoint)
  540.         asatzdaten (ssget eppunkt '((0 . "INSERT") (-3 ("INFO_REFERENZ"))))
  541.         )
  542.         (setvar "OSMODE" 0)
  543.         (if (/= asatzdaten nil)
  544.         (progn
  545.         (setq             
  546.               refdata (entget (ssname asatzdaten 0) '("INFO_REFERENZ")) 
  547.               refwert (cdr (assoc -3 refdata))
  548.               ref (cdr (assoc 1005 (cdar refwert)))
  549.               info (handent ref)
  550.          )
  551.          (redraw info 3)
  552.          )
  553.          )
  554. )
  555.  
  556. (defun SplitFn ( PfadDatei / len lenpoint ch z)
  557.  
  558.        (setq len (strlen PfadDatei) lenpoint (strlen PfadDatei) z 0)
  559.        (while (and 
  560.                 (> len 0) 
  561.                 (/= (setq ch (substr PfadDatei len 1)) "\\")
  562.                 (/= ch "/")
  563.                 (/= ch ":")
  564.               )
  565.               (setq len (1- len))
  566.               (if (AND (< z 1)(= ch ".")) (setq lenpoint len z (1+ z)))
  567.        )
  568.        (cons (substr PfadDatei 1 len) (substr PfadDatei (1+ len) (- lenpoint len)))
  569. );defun
  570.  
  571.  
  572. ;Programm setzt die von ACAD14 fⁿr CR/LF gesetzten Steuerzeichen um in solche Steuerzeichen,
  573. ;die ML3 auch lesen kann. read-line kann die von ACAD14 gesetzten Zeichen richtig interpre-
  574. ;tieren und write-line schreibt sie so weg, wie ML3 sie braucht.
  575. (defun EAITreadwrite (datei / of1 of2 zeile)
  576.   (setq of1 (open (strcat datei ".txt") "r"))
  577.   (setq of2 (open (strcat EAITpfm "EAITrewr.txt") "w"))
  578.   (while (setq zeile (read-line of1))
  579.     (write-line zeile of2)
  580.   )
  581.   (close of1)
  582.   (close of2)
  583.   (command "EAITshell"
  584.        (strcat "copy "
  585.            (strcat EAITpfm "EAITrewr.txt ")
  586.            (strcat datei ".txt")
  587.        )
  588.   )
  589. )
  590.  
  591.  
  592. (princ)
  593.